package com.tlscpro.zwt.dao.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.tlscpro.zwt.dao.SystemUserDao;
import com.tlscpro.zwt.entity.TlscUser;
import com.tlscpro.zwt.mapper.TlscUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class SystemUserDaoImpl implements SystemUserDao {
    @Autowired
    TlscUserMapper tlscUserMapper;

    @Override
    public List<TlscUser> selectSystemUserList() {
        return tlscUserMapper.selectList(null);
    }

    @Override
    public TlscUser selectSystemUser(String userName, String password) {
        QueryWrapper<TlscUser> wrapper = Wrappers.query();
        wrapper.eq("user_name",userName).eq("password",password);
        return tlscUserMapper.selectOne(wrapper);
    }

    @Override
    public int insertSystemUser(TlscUser tlscUser){
        return tlscUserMapper.insert(tlscUser);
    }
}
